import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { BbbService } from './bbb.service';
import { RequireLogin, RequirePermission } from '../custom.decorator';  //自定义装饰器
import { ApiBearerAuth } from '@nestjs/swagger';

@Controller('bbb')
@RequireLogin()
@ApiBearerAuth()
export class BbbController {
  constructor(private readonly bbbService: BbbService) {}

  @Post()
  @RequirePermission('create_bbb')
  create() {
    return this.bbbService.create();
  }

  @Get()
  @RequirePermission('query_bbb','create_bbb')
  findAll() {
    return this.bbbService.findAll();
  }

  @Get(':id')
  @RequirePermission('create_aaa','query_aaa')
  findOne(@Param('id') id: string) {
    return this.bbbService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string) {
    return this.bbbService.update(+id);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.bbbService.remove(+id);
  }
}
